using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Drawing;

namespace Booker
{
   public class PanelLibros:Panel
    {
       private PictureBox _portada;
       private PictureBox _recomendacion;
       private Label _valoracion;
       private Label _titulo;
      // private Label _autor;
      // private TextBox _descripcion;
       private Ficha _ficha;
       public bool recomendado;
       private bool _login;
       private MenuLogin _panel;
       private String _usuario;
       public PanelLibros(bool login, MenuLogin panel,String usuario)
       {
           _usuario = usuario;
           _panel = panel;
           _login = login;
           _portada = new PictureBox();
           _recomendacion = new PictureBox();
           _valoracion = new Label();
           _titulo=new Label();
          // _autor = new Label();
          // _descripcion = new TextBox();
           _portada.MouseLeave += new System.EventHandler(this.Panel_MouseLeave);
           _portada.Click += new System.EventHandler(this.Panel_click);
           _portada.MouseEnter += new System.EventHandler(this.Panel_MouseEnter);
          
           this.Controls.Add(_titulo);
           this.Controls.Add(_portada);
       //    this.Controls.Add(_autor);
        //   this.Controls.Add(_descripcion);
           this.Controls.Add(_recomendacion);
           this.Controls.Add(_valoracion);
       }
       
       public Image imagenPortada
       {
           set
           {
               if (recomendado)
               {
                   _recomendacion.Image = global::Booker.Properties.Resources.ico_estrlla_rellena;
                   _recomendacion.Size = new Size((int)(this.Width * 0.2), (int)(this.Height * 0.2));
                   _recomendacion.Location = new Point(10, 79);
                   _recomendacion.SizeMode = PictureBoxSizeMode.Zoom;
               }

               _portada.Image = value;
               _portada.Size = new Size((int)(this.Width*0.31), (int)(this.Height*0.60));
               _portada.Location = new Point(5, 5);
               _portada.SizeMode = PictureBoxSizeMode.Zoom;
               _portada.Cursor = Cursors.Hand;
          
               _valoracion.Text = "3.45/5.00";
               _valoracion.Location = new Point(10, 68);

               
           }
           get
           {
               return _portada.Image;
           }
       }

       public String titulo
       {
           set
           {
               _titulo.Font = new System.Drawing.Font("Microsoft Sans Serif", 24F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
               _titulo.Text = value;
               _titulo.AutoSize = true;
               _titulo.Location = new Point((int)(this.Width * 0.20), 5);
           }
           get
           {
               return _titulo.Text;
           }
       }

      /* public String autor
       {
           set
           {
               _autor.Text = value;
               _autor.AutoSize = true;
               _autor.Location = new Point((int)(this.Width * 0.20), 20);
           }
           get
           {
               return _autor.Text;
           }
       }
       public String descripcion
       {
           set
           {
              
               _descripcion.BackColor = Color.White;
               _descripcion.BorderStyle = BorderStyle.None;
               _descripcion.Text = value;
               _descripcion.Size = new Size((int)(this.Width * 0.90), (int)(this.Height ));
               _descripcion.Location = new Point((int)(this.Width * 0.20), 40);
               _descripcion.Multiline = true;
               _descripcion.ReadOnly = true;
               _descripcion.ScrollBars = ScrollBars.Vertical;
           }
           get
           {
               return _descripcion.Text;
           }
       }*/

       private void Panel_click(object sender, EventArgs e)
       {
           _ficha = new Ficha(_login, _usuario);
           _panel.Hide();
           _ficha.Show();
       }

       private void Panel_MouseEnter(object sender, EventArgs e)
       {
           _portada.BorderStyle = BorderStyle.Fixed3D;
       }
       private void Panel_MouseLeave(object sender, EventArgs e)
       {
           _portada.BorderStyle = BorderStyle.None;
       }
       


    }
}
